package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.dal.mapper.ext.OrderCustomerRelExtMapper;
import com.mhc.suzuki.dal.model.OrderCustomerRelDO;
import com.mhc.suzuki.dal.query.OrderCustomerRelQuery;
import com.mhc.suzuki.manager.OrderCustomerRelManager;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;


/**
 * Manager for OrderCustomerRel.
 */

@Component
public class OrderCustomerRelManagerImpl implements OrderCustomerRelManager {


    @Autowired
    protected OrderCustomerRelExtMapper orderCustomerRelExtMapper;

    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(OrderCustomerRelQuery query) {
        return orderCustomerRelExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(OrderCustomerRelQuery query) {
        return orderCustomerRelExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(OrderCustomerRelDO record) {
        return orderCustomerRelExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(OrderCustomerRelDO record) {
        return orderCustomerRelExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<OrderCustomerRelDO> selectByQuery(OrderCustomerRelQuery query) {
        return orderCustomerRelExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
     */
    @Override
    public PageResult<OrderCustomerRelDO> selectByQueryWithPage(OrderCustomerRelQuery query) {
        PageResult<OrderCustomerRelDO> result = new PageResult<OrderCustomerRelDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public OrderCustomerRelDO selectByPrimaryKey(Long id) {
        return orderCustomerRelExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective(OrderCustomerRelDO record, OrderCustomerRelQuery query) {
        return orderCustomerRelExtMapper.updateByQuerySelective(record, query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery(OrderCustomerRelDO record, OrderCustomerRelQuery query) {

        return orderCustomerRelExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(OrderCustomerRelDO record) {
        return orderCustomerRelExtMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int exchangeBuyer(Map map) {
        return orderCustomerRelExtMapper.exchangeBuyer(map);
    }
}